Skip to content

Address bug with CSV import on sync job #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

msheiny
Copy link
Contributor

@msheiny msheiny commented Jan 30, 2025

Closes: #313

What's Changed

  • Made fixes to ensure connectivity_test is passed through under the Sync from Network job when using a CSV

I added some additional tests, made the default behavior more resilient if the argument isn't passed for some reason, and tested the change explicitly on my local box after the code changes (using a containerlab device):

image

To Do

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • Documentation Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

@msheiny msheiny marked this pull request as ready for review January 30, 2025 01:34
@@ -118,7 +118,7 @@ def netmiko_send_commands(
return Result(
host=task.host, result=f"{task.host.name} has missing definitions in command_mapper YAML file.", failed=True
)
if orig_job_kwargs["connectivity_test"]:
if orig_job_kwargs.get("connectivity_test", False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connectivity is guaranteed to be present right? Nit pick but just curious on the .get() instead of key call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's not "guaranteed" to be present because its all getting passed in via optional kwargs from method to method. This is one of the dangers of passing around **kwargs that are optional to python but required to the logic.

one thing I could tweak is to make it a required field on the method and make the subsequent changes on upstream callers callers in this PR. OR i could add a check at the top of this method to throw an exception if its not passed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the .get as a safety measure in case someone used this method in the future and didn't pass it BUT yeah i think its better to explicitly throw an exception OR require it as a method variable

@msheiny msheiny mentioned this pull request Feb 7, 2025
6 tasks
@scetron scetron merged commit 7fcf6f1 into nautobot:develop Feb 10, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in Sync Devices From Network job
4 participants